home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / progs / Netobj / CDK / NetObjectsFusionCDK5_97.exe / _SETUP.1 / DynaButtonsComp.java < prev    next >
Encoding:
Java Source  |  1997-05-14  |  19.7 KB  |  765 lines

  1. import ComponentApp;
  2. import ButtonObject;
  3.  
  4. public class DynaButtonsComp extends ComponentApp 
  5. {
  6.     int backgroundStyle =0 ;
  7.     DAssetManager assMan = null;
  8.     int upID = 0, downID = 0;    
  9.     String Orientation = "";    
  10.     String ButtonImage = "", HighliteImage = "";
  11.     String paramButtonImage = "", paramHighliteImage = "";
  12.     int backgroundColor = 0;
  13.     String backgroundImage = "";
  14.     String paramBackgroundImage = "";
  15.     int textJustification = 0;
  16.     int textAlignment = 0;
  17.     int fontColor = 0;
  18.     int highliteFontColor = 0;
  19.     String buttonFont = "";
  20.     boolean italic = false;
  21.     boolean bold = false;
  22.     int fontSize = 0;    
  23.     ButtonObject buttonList = null;    
  24.     DDrawJava theJavaApplet = null;        
  25.     String compImage = "";
  26.     int imgX = 0,imgY = 0;
  27.     String indent = "    ";
  28.     String cb;
  29.     
  30.     void SetPropertyValues()
  31.     {
  32.         theJavaApplet.ResetParams();
  33.  
  34.         // used to speed up loading under Netscape 3.0+
  35.         theJavaApplet.setHTMLBetween("ARCHIVE=DynaButtons.zip");
  36.  
  37.         // used to speed up loading under IE 3.0
  38.         theJavaApplet.AddParam("cabbase",typeString,"DynaButtons.cab");
  39.  
  40.         theJavaApplet.AddParam("Orientation",typeString,Orientation);                        
  41.         theJavaApplet.AddParam("ButtonImage",typeString,paramButtonImage);
  42.         theJavaApplet.AddParam("HighliteImage",typeString,paramHighliteImage);        
  43.         theJavaApplet.AddParam("TextJustification",typeString,Integer.toString(textJustification));
  44.         theJavaApplet.AddParam("TextAlignment",typeString,Integer.toString(textAlignment));                
  45.         theJavaApplet.AddParam("ButtonFont",typeString,buttonFont);
  46.         theJavaApplet.AddParam("FontSize",typeString,Integer.toString(fontSize));
  47.         theJavaApplet.AddParam("FontColor",typeString,Integer.toString(fontColor));
  48.         theJavaApplet.AddParam("HighliteFontColor",typeString,Integer.toString(highliteFontColor));
  49.         
  50.         if (bold)
  51.             theJavaApplet.AddParam("Bold",typeString,"True");
  52.         if (italic)
  53.             theJavaApplet.AddParam("Italic",typeString,"True");                
  54.  
  55.         if (backgroundStyle == BackgroundStyle.SolidColor)
  56.             theJavaApplet.AddParam("BackgroundColor",typeString,Integer.toString(backgroundColor));
  57.         else if (backgroundStyle == BackgroundStyle.Image)
  58.             theJavaApplet.AddParam("BackgroundImage",typeString,paramBackgroundImage);
  59.         
  60.         ButtonObject tempList = buttonList.getNext();
  61.         
  62.         // start this loop at 0 for the applet
  63.  
  64.         for (int i=0; tempList != null; i++)
  65.         {                        
  66.             if (tempList.getSubButtonsExist())
  67.             {
  68.                 if (tempList.getText().compareTo("") == 0)
  69.                     theJavaApplet.AddParam("ButtonText"+i,typeString," ");
  70.                 else
  71.                     theJavaApplet.AddParam("ButtonText"+i,typeString,tempList.getText());
  72.  
  73.                 // first button is a dummy
  74.                 ButtonObject subList = tempList.getSubButtons().getNext();
  75.                 
  76.                 for (int j=0; subList != null; j++)
  77.                 {                
  78.                     if (subList.getText().compareTo("") == 0)
  79.                     {
  80.                         theJavaApplet.AddParam("ButtonText"+i+"_"+j,typeString," ");
  81.                         theJavaApplet.AddParam("URL"+i+"_"+j,typeString," ");
  82.                     }
  83.                     else
  84.                     {
  85.                         theJavaApplet.AddParam("ButtonText"+i+"_"+j,typeString,subList.getText());
  86.                         theJavaApplet.AddParam("URL"+i+"_"+j,typeString,subList.getURL());
  87.                     }
  88.                                                                 
  89.                     subList = subList.getNext();
  90.                 }                                
  91.             }
  92.             else
  93.             {
  94.                 if (tempList.getText().compareTo("") == 0)
  95.                     theJavaApplet.AddParam("ButtonText"+i,typeString," ");
  96.                 else
  97.                 {
  98.                     String buttonText = assMan.GetAssetName(Integer.parseInt(tempList.getID(),10));
  99.                     theJavaApplet.AddParam("ButtonText"+i,typeString,buttonText);
  100.                 }
  101.             
  102.                 theJavaApplet.AddParam("URL"+i,typeString,tempList.getURL());
  103.             }
  104.             
  105.             tempList = tempList.getNext();
  106.         }
  107.     }
  108.     
  109.     public String onInstall(DAssetManager cam, String codebase) 
  110.     { 
  111.         assMan = cam;
  112.         compImage = codebase + "DYNBUTTON.gif";            
  113.         return "DynaButtons";
  114.     }
  115.     
  116.     public void onInspect(CStringArray Names,CStringArray Types)
  117.     { 
  118.         Names.Set("Orientation");
  119.         Types.Set("Set(Horizontal|Vertical)");        
  120.         Names.Set("Number of Buttons");
  121.         Types.Set(typeJavaCollection);        
  122.         ButtonObject tempList = buttonList.getNext();
  123.         
  124.         for (int i=1; tempList != null; i++)
  125.         {                        
  126.             if (tempList.getSubButtonsExist())
  127.             {
  128.                 Names.Set("Button "+i);
  129.                 Types.Set(typeString);                    
  130.                 Names.Set("Use Sub-Buttons "+i);
  131.                 Types.Set("Set(Yes|No)");
  132.                 Names.Set("Number Sub-Buttons "+i);
  133.                 Types.Set(typeJavaCollection);            
  134.                 ButtonObject subList = tempList.getSubButtons().getNext();
  135.                 
  136.                 for (int j=1; subList != null; j++)
  137.                 {
  138.                     Names.Set(indent + "Sub-Button "+i+","+j);
  139.                     Types.Set(typeLink);                    
  140.                     subList = subList.getNext();
  141.                 }
  142.             }
  143.             else
  144.             {
  145.                 Names.Set("Button "+i);
  146.                 Types.Set(typeLink);    
  147.                 Names.Set("Use Sub-Buttons "+i);
  148.                 Types.Set("Set(Yes|No)");
  149.             }
  150.             
  151.             tempList = tempList.getNext();
  152.         }
  153.     }
  154.     
  155.     private void modifyNumButtons(int newLength, ButtonObject currentList)
  156.     {        
  157.         int currentLength = countButtons(currentList);
  158.         
  159.         if (newLength < currentLength)   // make the list shorter
  160.         {
  161.             for (int i=0; i < newLength; i++)
  162.             {
  163.                 currentList = currentList.getNext();
  164.             }
  165.             currentList.setNext(null);
  166.         }
  167.         else if (newLength > currentLength)     // make the list longer
  168.         {        
  169.             for (int i=0; i < newLength; i++)
  170.             {
  171.                 if (currentList.getNext() == null)
  172.                 {
  173.                     currentList.setNext(new ButtonObject());
  174.                 }
  175.                 currentList = currentList.getNext();
  176.             }
  177.         }
  178.     }
  179.     
  180.     private int countButtons(ButtonObject buttonList)
  181.     {
  182.         int num=0;
  183.         
  184.         // the first button is a dummy
  185.         ButtonObject tempList = buttonList.getNext();
  186.         
  187.         while (tempList != null)
  188.         {
  189.             num++;
  190.             tempList = tempList.getNext();
  191.         }
  192.         
  193.         return num;
  194.     }
  195.     
  196.     
  197.     public String PropertyListener(String Event,String Value,int Get, int propIndex, IDInspector insp)
  198.     {
  199.         // return a value
  200.         
  201.         if (Get == 1)
  202.         {
  203.             if (Event.compareTo("Orientation") == 0)
  204.             {
  205.                 if (Orientation.compareTo("Horizontal") == 0)
  206.                     return ("0");
  207.                 else
  208.                     return ("1");
  209.             }
  210.             else if (Event.compareTo("Number of Buttons") == 0)
  211.             {
  212.                 return Integer.toString(countButtons(buttonList));
  213.             }
  214.             else
  215.             {
  216.                 // the first button is a dummy
  217.                 ButtonObject tempList = buttonList.getNext();            
  218.                 
  219.                 for (int i=1; tempList != null; i++)
  220.                 {
  221.                     if (Event.compareTo("Use Sub-Buttons "+i)==0)
  222.                     {
  223.                         if (tempList.getSubButtonsExist())
  224.                             return ("0");
  225.                         else
  226.                             return ("1");
  227.                     }
  228.                     
  229.                     if (Event.compareTo("Button "+i) == 0)
  230.                     {                    
  231.                         if (tempList.getSubButtonsExist())
  232.                             return (tempList.getText());
  233.                         else
  234.                             return (tempList.getID());
  235.                     }
  236.                     
  237.                     ButtonObject subList = tempList.getSubButtons();
  238.                     
  239.                     if (Event.compareTo("Number Sub-Buttons "+i) ==0)
  240.                     {
  241.                         return Integer.toString(countButtons(subList));
  242.                     }
  243.                     
  244.                     subList = subList.getNext();
  245.                     
  246.                     for (int j=1; subList != null; j++)
  247.                     {
  248.                         if (Event.compareTo(indent + "Sub-Button "+i+","+j) == 0)
  249.                         {
  250.                             return (subList.getID());
  251.                         }
  252.                         
  253.                         subList = subList.getNext();
  254.                     }
  255.                     
  256.                     tempList = tempList.getNext();
  257.                 }
  258.             }
  259.         }        
  260.         else    // user set a value
  261.         {
  262.             if (Event.compareTo("Orientation")==0)
  263.             {
  264.                 if (Value.compareTo("0") == 0)
  265.                 {
  266.                     Orientation = "Horizontal";                    
  267.                 }
  268.                 else
  269.                 {
  270.                     Orientation = "Vertical";                                                                                                        
  271.                 }
  272.  
  273.                 debug("\r\nrandom:");
  274.                 checkList(buttonList);
  275.                 
  276.                 modifyImageSize();
  277.             }
  278.             else if (Event.compareTo("Number of Buttons") == 0)
  279.             {
  280.                 int NumButtons = Integer.parseInt(Value,10);
  281.  
  282.                 if (NumButtons > 20)
  283.                     NumButtons = 20;
  284.  
  285.                 modifyNumButtons(NumButtons,buttonList);
  286.                 modifyImageSize();
  287.             }
  288.             else
  289.             {                                
  290.                 ButtonObject tempList = buttonList.getNext();                
  291.                 
  292.                 for (int i=1; tempList != null; i++)
  293.                 {
  294.                     if (Event.compareTo("Button "+i)==0)
  295.                     {        
  296.                         if (tempList.getSubButtonsExist())
  297.                         {
  298.                             tempList.setText(Value);                            
  299.                         }
  300.                         else
  301.                         {                            
  302.                             tempList.setID(Value);                            
  303.                             tempList.setText(assMan.GetAssetName(Integer.parseInt(Value,10)));
  304.                         }
  305.                     }
  306.                     else if (Event.compareTo("Use Sub-Buttons "+i)==0)
  307.                     {
  308.                         if (Value.compareTo("0") == 0)
  309.                         {
  310.                             tempList.setSubButtonsExist(true);
  311.                             
  312.                             if (insp != null)
  313.                                 insp.OnPropertyChanged(-1);
  314.                         }
  315.                         else
  316.                         {
  317.                             tempList.setSubButtonsExist(false);
  318.                             
  319.                             if (insp != null)
  320.                                 insp.OnPropertyChanged(-1);
  321.                         }
  322.                         modifyImageSize();
  323.                     }
  324.                     else if (Event.compareTo("Number Sub-Buttons "+i)==0)
  325.                     {
  326.                         int NumButtons = Integer.parseInt(Value,10);
  327.  
  328.                         if (NumButtons > 20)
  329.                             NumButtons = 20;
  330.  
  331.                         modifyNumButtons(NumButtons,tempList.getSubButtons());
  332.                         modifyImageSize();
  333.                     }
  334.                     else
  335.                     {
  336.                         // go through the subButtons
  337.                         
  338.                         ButtonObject subList = tempList.getSubButtons().getNext();
  339.                         
  340.                         for (int j=1; subList != null; j++)
  341.                         {
  342.                             if (Event.compareTo(indent + "Sub-Button "+i+","+j) == 0)
  343.                             {                            
  344.                                 subList.setID(Value);
  345.                                 subList.setText(assMan.GetAssetName(Integer.parseInt(Value,10)));                            
  346.                             }                            
  347.                             
  348.                             subList = subList.getNext();
  349.                         }
  350.                     }
  351.                     tempList = tempList.getNext();
  352.                 }
  353.             }
  354.             
  355.             SetPropertyValues();
  356.         }        
  357.         return ("");
  358.     }
  359.  
  360.     private void modifyImageSize()
  361.     {
  362.         int width=0;
  363.         int height=0;
  364.         ButtonObject tempList = buttonList.getNext();
  365.  
  366.         if (Orientation.compareTo("Horizontal") == 0)
  367.         {
  368.             width = countButtons(buttonList);  // width is the top buttons,
  369.                         
  370.             // height is 1 + max sub buttons
  371.             
  372.             while(tempList != null)
  373.             {
  374.                 if (height == 0)
  375.                     height = 1;
  376.  
  377.                 if (tempList.getSubButtonsExist())
  378.                 {                    
  379.                     // add 1 to account for the top level buttons
  380.                     int numSubButtons = countButtons(tempList.getSubButtons()) + 1;
  381.                     
  382.                     if (numSubButtons > height)
  383.                         height = numSubButtons;
  384.                 }
  385.                 tempList = tempList.getNext();
  386.             }
  387.         }
  388.         else
  389.         {                        
  390.             height = countButtons(buttonList);  // width is the top buttons,
  391.  
  392.             // height is max depth, accounting for the parent depth
  393.             
  394.             for (int i=1; tempList != null; i++)
  395.             {                
  396.                 if (width == 0)
  397.                     width = 1;
  398.  
  399.                 if (tempList.getSubButtonsExist())
  400.                 {            
  401.                     width = 2;
  402.  
  403.                     // add 1 to account for the top level buttons
  404.                     int numSubButtons = countButtons(tempList.getSubButtons()) + i;
  405.                     
  406.                     if (numSubButtons > height)
  407.                         height = numSubButtons;
  408.                 }
  409.                 tempList = tempList.getNext();
  410.             }
  411.         }
  412.                         
  413.         theJavaApplet.SetSize((width*imgX), (height*imgY));
  414.     }
  415.     
  416.     public void onDrop(IDLayout layout, IDRect r, int fDrop) 
  417.     {        
  418.         if (fDrop == ActivateState.Drop)  // the first time the component is dropped
  419.         {
  420.             theJavaApplet = new DDrawJava();
  421.             theJavaApplet.SetStyle(DrawObjectStyle.NonResizable,DrawObjectStyle.NonResizable);            
  422.             theJavaApplet.setStretch(PictureStretchMode.DRAW_STRETCHED);
  423.             
  424.             // the first button is a dummy
  425.             buttonList = new ButtonObject();
  426.             buttonList.setNext(new ButtonObject());
  427.             
  428.             theJavaApplet.SetPositionRect(r.getLeft(), r.getTop(), r.getLeft(), r.getTop());            
  429.             Orientation = "Horizontal";            
  430.             theJavaApplet.setImageFile(compImage);
  431.             theJavaApplet.setUsePictureText(true);
  432.             theJavaApplet.setPictureText("DynaButtons");
  433.  
  434.             cb = theJavaApplet.getCodeBase();
  435.             theJavaApplet.setAppletFileName(cb + "DynaButtons.class");                            
  436.             theJavaApplet.AddAdditionalAppletFile(cb + "PopButton.class");
  437.             theJavaApplet.AddAdditionalAppletFile(cb + "PopObject.class");
  438.             theJavaApplet.AddAdditionalAppletFile(cb + "DynaButtons.cab");
  439.             layout.AddObject(theJavaApplet);
  440.         }
  441.         if (fDrop != ActivateState.Paste && fDrop != ActivateState.Undo) {
  442.             updateSiteLook(IAssetContext.Local);
  443.             SetPropertyValues();
  444.         }
  445.     }
  446.     
  447.     
  448.     private void updateSiteLook(int context)
  449.     {        
  450.         IDLayout layout = theJavaApplet.getLayout();
  451.         IDSite site  = layout.getSite();
  452.         IDStyle style = site.getCurrentStyle();        
  453.         
  454.         // first check the layout background, then the site style
  455.         
  456.         backgroundStyle = layout.getBackgroundStyle();
  457.         
  458.         if (backgroundStyle != BackgroundStyle.None)
  459.         {
  460.             if (backgroundStyle == BackgroundStyle.SolidColor)
  461.                 backgroundColor = layout.getBackgroundColor();
  462.             else if (backgroundStyle == BackgroundStyle.Image)
  463.             {
  464.                 int backID = assMan.AddAsset(layout.getBackgroundImage(),IAssetType.Image,"");        
  465.                 backgroundImage = assMan.GetAssetRelativeLocation(backID,context,1);
  466.             }
  467.         }
  468.         else // use the site style
  469.         {        
  470.             backgroundStyle = style.getBackgroundStyle();
  471.             
  472.             if (backgroundStyle == BackgroundStyle.SolidColor)
  473.                 backgroundColor = style.getBackgroundColor();
  474.             else if (backgroundStyle == BackgroundStyle.Image)
  475.             {
  476.                 int backID = assMan.AddAsset(style.getBackgroundImage(),IAssetType.Image,"");        
  477.                 backgroundImage = assMan.GetAssetRelativeLocation(backID,context,1);
  478.             }
  479.         }
  480.         
  481.         textJustification = 5;  // center center  set later
  482.         textAlignment = style.getButtonTextAlign();
  483.         fontColor = style.getButtonFontColor();    
  484.         highliteFontColor = style.getButtonDownFontColor();                
  485.         IDFont font = style.getButtonFont();
  486.         buttonFont = font.getName();
  487.         fontSize = font.getPoint();
  488.         bold = font.getBold();
  489.         italic = font.getItalic();        
  490.  
  491.         String buttonUp = style.getButtonUpImage();
  492.         
  493.         //debug("buttonUp: "+buttonUp);
  494.  
  495.         if (buttonUp == null || buttonUp.compareTo("") == 0)
  496.             buttonUp = cb + "transButton.gif";
  497.  
  498.         String buttonDown = style.getButtonDownImage();    
  499.         
  500.         if (buttonDown == null || buttonDown.compareTo("") == 0)
  501.             buttonDown = cb + "transButton.gif";
  502.  
  503.         //
  504.         // DS 1/29/87
  505.         // remove old assets before adding new ones
  506.         //
  507.         RemoveAssets();
  508.         // DS 1/29/87
  509.  
  510.         upID = assMan.AddAsset(buttonUp,IAssetType.Image,"");
  511.         downID = assMan.AddAsset(buttonDown,IAssetType.Image,"");                
  512.         ButtonImage = assMan.GetAssetRelativeLocation(upID,context,1);
  513.         HighliteImage = assMan.GetAssetRelativeLocation(downID,context,1);            
  514.         IDSize  buttonSize = style.getButtonSize();        
  515.         //
  516.         // DS fix 1/28/97, no style button image fix
  517.         //
  518.         if (buttonSize != null) {
  519.             imgX = buttonSize.getWidth();
  520.             imgY = buttonSize.getHeight();
  521.         } else {
  522.             //
  523.             // default to plain button size
  524.             //
  525.             imgX = 100;
  526.             imgY = 35;
  527.         }
  528.         // DS fix 1/28/97
  529.         
  530.         modifyImageSize();
  531.     }
  532.     
  533.     private void debug(String out)
  534.     {    
  535.         //DMessageBox d = new DMessageBox();
  536.         //d.Trace(out + "\r\n");
  537.     }
  538.     
  539.  
  540.     private void setAllUrls(int context)
  541.     {
  542.         ButtonObject tempList = buttonList.getNext();                
  543.         
  544.         for (int i=1; tempList != null; i++)        
  545.         {                    
  546.             String theURL = assMan.GetAssetRelativeLocation(Integer.parseInt(tempList.getID(),10),context,1);                        
  547.             tempList.setURL(theURL);
  548.     
  549.             if (tempList.getSubButtonsExist())
  550.             {
  551.                 ButtonObject subList = tempList.getSubButtons().getNext();
  552.                 
  553.                 for (int j=1; subList != null; j++)
  554.                 {
  555.                     String subURL = assMan.GetAssetRelativeLocation(Integer.parseInt(subList.getID(),10),context,1);
  556.                     subList.setURL(subURL);
  557.                     subList = subList.getNext();                        
  558.                 }
  559.             }
  560.             tempList = tempList.getNext();
  561.         }
  562.     }
  563.  
  564.  
  565.     public void onPublish(DAssetManager asm, int context)     
  566.     {
  567.         //debug ("<publish> length of original: "+countButtons(buttonList));
  568.  
  569.         updateSiteLook(context);
  570.         setAllUrls(context);
  571.         
  572.         if (context == IAssetContext.Preview)
  573.         {    
  574.             paramButtonImage = "file:///" + ButtonImage;
  575.             paramHighliteImage = "file:///" + HighliteImage;
  576.             paramBackgroundImage = "file:///" + backgroundImage;             
  577.         }
  578.         else
  579.         {
  580.             paramButtonImage = ButtonImage;
  581.             paramHighliteImage = HighliteImage;
  582.             paramBackgroundImage = backgroundImage;
  583.         }
  584.         
  585.         SetPropertyValues();
  586.         IDRect thePosition=theJavaApplet.getObjectRect();
  587.         theJavaApplet.AddParam("X Position",typeString,Integer.toString(thePosition.getLeft()));
  588.         theJavaApplet.AddParam("Y Position",typeString,Integer.toString(thePosition.getTop()+7));
  589.     }
  590.  
  591.     //
  592.     // DS 1/29/87 add RemoveAssets() fucntion
  593.     //
  594.     protected void RemoveAssets() {
  595.         if (upID != 0) {
  596.             assMan.RemoveAsset(upID);
  597.             assMan.RemoveAsset(downID);
  598.         }
  599.     }
  600.  
  601.     //
  602.     // 2/5/97 leak fix
  603.     //
  604.     protected void RemoveOneAsset(String assetIDStr) {
  605.         int assetID = Integer.parseInt(assetIDStr,10);
  606.         if (assetID != 0)
  607.             assMan.RemoveAsset(assetID);
  608.     }
  609.  
  610.     //
  611.     // 2/5/97 leak fix
  612.     //
  613.     protected void CopyOneAsset(String assetIDStr) {
  614.         int assetID = Integer.parseInt(assetIDStr,10);
  615.         if (assetID != 0)
  616.             assMan.CopyAsset(assetID);
  617.     }
  618.     
  619.     protected void finalize()
  620.     {
  621.         RemoveAssets();
  622.  
  623.         ButtonObject tempList = buttonList.getNext();                
  624.         
  625.         for (int i=1; tempList != null; i++)        
  626.         {    
  627.             //
  628.             // 2/5/97 leak fix
  629.             //
  630.             RemoveOneAsset(tempList.getID());
  631.             if (tempList.getSubButtonsExist())
  632.             {
  633.                 ButtonObject subList = tempList.getSubButtons().getNext();
  634.  
  635.                 for (int j=1; subList != null; j++)
  636.                 {
  637.                     //
  638.                     // 2/5/97 leak fix
  639.                     //
  640.                     RemoveOneAsset(subList.getID());
  641.                     subList = subList.getNext();
  642.                 }
  643.             }
  644.             tempList = tempList.getNext();
  645.         }
  646.  
  647.     }
  648.  
  649.     public void onCopy()
  650.     {
  651.         debug("in onCopy()");
  652.  
  653.         Orientation = new String(Orientation);    
  654.         ButtonImage = new String(ButtonImage);
  655.         HighliteImage = new String(HighliteImage);
  656.         paramButtonImage = new String(paramButtonImage);
  657.         paramHighliteImage = new String(paramHighliteImage);
  658.         backgroundImage = new String(backgroundImage);    
  659.         buttonFont = new String(buttonFont);
  660.         compImage = new String(compImage);
  661.         indent = new String(indent);    
  662.  
  663.         assMan.CopyAsset(upID);
  664.         assMan.CopyAsset(downID);    
  665.  
  666.         // copy the linked list
  667.  
  668.         ButtonObject copyButtonList = new ButtonObject();
  669.         ButtonObject copyTempList = copyButtonList;
  670.  
  671.         debug ("<copy> length of original: "+countButtons(buttonList));
  672.  
  673.         ButtonObject tempList = buttonList.getNext();                
  674.         
  675.         debug("about to copy list");
  676.  
  677.         for (int i=1; tempList != null; i++)        
  678.         {    
  679.             debug("in copy list");
  680.  
  681.             copyTempList.setNext(new ButtonObject());
  682.             copyTempList = copyTempList.getNext();
  683.  
  684.             //
  685.             // 2/5/97 leak fix
  686.             //
  687.             CopyOneAsset(tempList.getID());
  688.  
  689.             copyTempList.setID(tempList.getID());
  690.             copyTempList.setText(tempList.getText());
  691.             copyTempList.setURL(tempList.getURL());
  692.  
  693.             debug("copied: "+i);
  694.  
  695.             if (tempList.getSubButtonsExist())
  696.             {
  697.                 copyTempList.setSubButtonsExist(true);
  698.  
  699.                 ButtonObject subList = tempList.getSubButtons().getNext();
  700.                 ButtonObject copySubList = copyTempList.getSubButtons(); 
  701.  
  702.                 for (int j=1; subList != null; j++)
  703.                 {
  704.                     copySubList.setNext(new ButtonObject());
  705.                     copySubList = copySubList.getNext();
  706.  
  707.                     //
  708.                     // 2/5/97 leak fix
  709.                     //
  710.                     CopyOneAsset(subList.getID());
  711.                     copySubList.setID(subList.getID());
  712.                     copySubList.setText(subList.getText());
  713.                     copySubList.setURL(subList.getURL());                                            
  714.                     subList = subList.getNext();
  715.                 }
  716.             }
  717.             tempList = tempList.getNext();
  718.         }
  719.     /*
  720.         debug("length of copy: "+countButtons(copyButtonList));
  721.  
  722.  
  723.         debug("\r\nthe original:");
  724.         checkList(buttonList);
  725.  
  726.         debug("\r\nthe copy:");
  727.         checkList(copyButtonList);
  728.     */
  729.         buttonList = copyButtonList;
  730.     }
  731.  
  732.  
  733.     void checkList(ButtonObject list)
  734.     {
  735.         /*
  736.         debug("in checkList()");
  737.  
  738.         ButtonObject tempList = list.getNext();                
  739.  
  740.         for (int i=1; tempList != null; i++)        
  741.         {    
  742.             debug("checking: "+i);
  743.  
  744.             debug("id: "+tempList.getID());
  745.             debug("text: "+tempList.getText());
  746.             debug("url: "+tempList.getURL());
  747.  
  748.             if (tempList.getSubButtonsExist())
  749.             {
  750.                 debug("sub-buttons exist for: "+i);
  751.                 ButtonObject subList = tempList.getSubButtons().getNext();
  752.         
  753.                 for (int j=1; subList != null; j++)
  754.                 {
  755.                     debug("sub id: "+subList.getID());
  756.                     debug("sub text: "+subList.getText());
  757.                     debug("sub url: "+subList.getURL());                                            
  758.                 }
  759.             }
  760.             tempList = tempList.getNext();
  761.         }
  762.         */
  763.     }
  764. }
  765.